<?php
$startTime = microtime(TRUE);

$con = mysqli_connect("localhost","softbos","developer","Logins");
mysqli_set_charset($con, "utf8");
if (mysqli_connect_errno()) {
  echo "Failed to connect to MySQL: " . mysqli_connect_error();
}

$i=0;
while(isset($_POST['Id'.$i])){
	$Id = mysqli_real_escape_string($con, $_POST['Id'.$i] );
	$Name = mysqli_real_escape_string($con, $_POST['Name'.$i] );
	$Address = mysqli_real_escape_string($con, $_POST['Address'.$i] );
	$sql = "INSERT INTO Company (Id, Name, Address) VALUES ($Id,'$Name','$Address')";
	
	if (!mysqli_query($con,$sql)) {
	  die('Error: ' . mysqli_error($con));
	}
	echo $sql.'<br/>';
	$i++;
}

mysqli_close($con);
echo "Processed $i INSERT query(ies) " .(microtime(TRUE) - $startTime)."sec <br/>";	
?> 
